package com.qijian.maindata.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qijian.maindata.domain.Line;
import com.qijian.maindata.domain.LineBom;
import com.qijian.maindata.domain.Project;
import com.qijian.maindata.domain.query.LineBomQuery;
import com.qijian.maindata.domain.query.LineQuery;
import com.qijian.maindata.domain.vo.LineVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 工艺线路Mapper接口
 *
 * @author qijian
 * @date 2021-09-03
 */
public interface LineMapper extends BaseMapper<Line> {

    Page<LineVo> selectPageVo(Page<Project> page, @Param(Constants.WRAPPER) Wrapper<LineQuery> queryWrapper);

    List<LineVo> selectPageVo(@Param(Constants.WRAPPER) Wrapper<LineQuery> queryWrapper);

    void saveDetail(@Param("lineBomList") List<LineBom> lineBomList);

    void delDetail(Long lineId);

    int bomCount(@Param(Constants.WRAPPER) Wrapper<LineBomQuery> queryWrapper);

    @Select("select count(0) from main_line WHERE create_time >= CURRENT_DATE ")
    int countCurrentDateWithDel();
}
